package com.manong.config.security;

import com.manong.entity.User;
import com.manong.entity.UserInfo;
import lombok.val;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;


public class Utils {

    public static User getUser(){

        val authentication = SecurityContextHolder.getContext().getAuthentication();
        System.out.println(authentication);
        User user = (User) authentication.getPrincipal();
        return user;
    }

}
